package com.lfd.validated.controller;

import com.lfd.validated.pojo.ApiResponse;
import com.lfd.validated.pojo.User;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @项目名： spring-emq
 * @包名： com.lfd.validated.controller
 * @文件名: UserController
 * @创建者: liufudong@szyh-smart.com
 * @创建时间: 2024/10/2 21:56
 * @描述：
 */

@RestController
public class UserController {
    //http://localhost:8089/addUser
    //{"username":"username","password":"password"}
    //如返回
//    {
//    "code": 400,
//    "message": null,
//    "data": {
//        "password": "密码不能为空",
//        "username": ""
//    }
//}
    @PostMapping("/addUser")
    public ApiResponse<User> addUser(@Validated @RequestBody User user) {
        return ApiResponse.success(user);
    }
}
